package app.itw.tison.service.user.impl;


import app.itw.tison.user.model.User;
import itw.app.tison.service.user.UserService;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.apache.dubbo.config.annotation.Service;


/**
 * 用户服务
 */
@Service(version = "1.0.0")
public class UserServiceImpl  implements UserService {

  //模拟数据
  public static   List<User> list = new ArrayList<User>();

  static {
    User user ;
    for (int i = 0; i < 10; i++) {
      user = new User("小谢"+i, "男", "1732433xxxx", "Dubbo2.7.1的Demo编写测试", new Date());
      list.add(user);
    }
  }

  @Override
  public User getUserByName(String name) {
    for (int i = 0; i < list.size(); i++) {
      if (name.equals(list.get(i).getName())){
        return list.get(i);
      }
    }
    return null;
  }

  @Override
  public List<User> getUserList() {
    return list;
  }
}
